-
Notifications
You must be signed in to change notification settings - Fork 533
changes in Interfaces base (closes #2320) #2387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Is this intended for 1.0, 1.0 maintenance, or 2.0? |
@effigies this are for 1.0, but don't know if we have to wait to include everything before release. Was planning to do it last week, but didn't happen.. Notice, that these are independent points that were suggested by me or @satra during #2303 revision. If you or @satra find time to review it we can merge before finishing all points (I'm trying to keep them in separate commits) and I can open a new PR. |
do you know anyone using |
Okay, I can have a look. As for MpiCommandLine, I would generally prefer not to remove functionality that someone may be using without a deprecation cycle. i.e. We should have had a few releases where we raised warnings that it was going to go away, which would give people time to complain or find another approach before we actually pull the rug out from under them. So unless there's a really compelling reason to remove it, I would leave it. If people think it's not worth supporting, we can deprecate it so it can be removed later. |
…t use a afast validator, so i renamed BaseFile(Directory) to File(Directory) and removed extra classes
@effigies ok, I removed Note that my last commits renamed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting on the first 5 points (perhaps not in order).
I would be inclined to leave *MultiPath
as it is for 1.0. External users depend on it. We can change it in 2.0. If you think it would be good to have *MultiObject
for 1.0, I would simply do:
InputMultiObject = InputMultiPath
OutputMultiObject = OutputMultiPath
This would allow users to begin switching to the new syntax before 2.0, without modifying the class hierarchy.
I'll get to the rest shortly, but wanted to get you some feedback right now.
check = dict(max_ver=lambda t: t is not None) | ||
names = trait_object.trait_names(**check) | ||
if names and self.version: | ||
version = LooseVersion(str(self.version)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I see a semantic difference in 955b3ad. I see:
if names and self.version:
... # Check min_ver
check = dict(...)
names = trait_object.trait_names(**check)
... # Check max_ver
Which becomes:
if names and self.version:
... # Check min_ver
check = dict(...)
names = trait_object.trait_names(**check)
if names and self.version:
... # Check max_ver
Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
answered lower in the discussion
@@ -119,20 +119,6 @@ def _xor_warn(self, obj, name, old, new): | |||
'which is already set') % (name, trait_name) | |||
raise IOError(msg) | |||
|
|||
def _requires_warn(self, obj, name, old, new): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to be called from _generate_handlers
.
nipype/nipype/interfaces/base.py
Lines 389 to 390 in 5495816
for elem in requires: | |
self.on_trait_change(self._requires_warn, elem) |
I was unable to quickly find the PR it was removed in, so it's hard to tell whether its removal was intentional or a mistake. As an unused private methods, I'm okay with getting rid of it, but @satra, if this should still be in _generate_handlers
, let us know.
@@ -54,7 +54,7 @@ class Str(Unicode): | |||
traits.DictStrStr = DictStrStr | |||
|
|||
|
|||
class BaseFile(BaseUnicode): | |||
class File(BaseUnicode): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unclear on the original justification for this separation, but dropping BaseFile
seems fine to me.
@@ -165,29 +151,6 @@ def _deprecated_warn(self, obj, name, old, new): | |||
'%s' % trait_spec.new_name: new | |||
}) | |||
|
|||
def _hash_infile(self, adict, key): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused private method. Good to remove, as far as I'm concerned. Again, @satra, feel free to override if this looks like a mistake.
"""Support for the pretty module | ||
|
||
pretty is included in ipython.externals for ipython > 0.10""" | ||
def _repr_pretty_(self, p, cycle): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with this, but we should verify that we can pretty print Bunches in IPython with this change. I don't know if the API changed beyond what method it looks for in your objects.
if it doesn't work quickly, I'd say remove the function altogether and create an issue to fix and re-add, rather than waste time on this today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just checked that pretty
from IPython.lib.pretty
uses _repr_pretty_
method (and completely ignored when it was named __pretty__
).
In my opinion it looks as "pretty" as simply printing Bunch
, so I can either remove it or keep my name.
Let me know if this was design to work with different library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like what it does is prevents an infinite loop during formating. Could you test with a bunch that contains itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you're right, for a bunch that contains itself it makes a difference! But only with the new name _repr_pretty_
.
And you don't actually have to import pretty in ipython.
I would not refactor |
@djarecka Review complete. I'll look at the max_ver issue locally. I don't see how your change can be fixing it, but if the test fails before and works after, I'll allow it. |
@effigies ok, I'm just working actually on |
@djarecka - basefile and basedirectory provide different validation error messages than from traits. the code is not the same. please don't remove when the code does not match the traits code. _requires_warn can be removed since we disabled that. there are many folks who rely on InputMultiPath for their external interfaces. MultiObject/Bunch should be left for the nipype 2.0 refactor. |
Ah, gotcha. Yeah, 👍 on |
Answering your question @effigies about the original justification: I'm not sure (@satra can correct me), but 2 classes |
@djarecka - the reason for the classes have nothing to do with the validator, only the error message. trait's own error message is very cryptic for missing files/directories. i'm fine with |
yes, I only meant that the reason to have two pairs |
It will be included in 2.0 This reverts commit 36ffda1.
changes in interface base listed in #2320:
_check_version_requirements
does not check the max_version, this block has wrong indentationI was a bit confused about
BaseFile
andFile
, etc., do we really need both? Also I believe that we're assuming thatBaseUnicode
uses the fast validator (https://github.com/oesteban/nipype/blob/ref/interface-base/nipype/interfaces/base/traits_extension.py#L98), but from traits documentation I understood thatUnicode
(notBaseUnicode
) uses the C-level fast validator (http://docs.enthought.com/traits/traits_api_reference/trait_types.html?highlight=baseunicode#traits.trait_types.BaseUnicode. Am I missing something?couldn't find a place where we're using
_requires_warn
the same about
_hash_infile
is
__pretty__
still working?is it for this package: http://ipython.readthedocs.io/en/stable/api/generated/IPython.lib.pretty.html#extending ?
they suggest
_repr_pretty_
Check on this
synchronize
Check the logic of this